﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;  

public partial class Players : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            sel_flag.DataSource = PlayerZones.LoadPlayerZones();
            sel_flag.DataTextField = "Player_Zone_Name";
            sel_flag.DataValueField = "Pk_PlayerZone";
            sel_flag.DataBind();

            sel_flag.Items.Insert(0, "Select...");
            sel_flag.Items[0].Value = "0";
            AjaxPro.Utility.RegisterTypeForAjax(typeof(Players));
        }
        catch (Exception Ex) {
            Response.Write(Ex.ToString());
        } 
        
    }
    [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)]
    public int CreatePlayer(string p_Name,string p_Nick,int p_PlayerNumber,int p_PlayerZone,int[] p_TournamentList)
    {
        try
        {
         
            Player oPlayer = new Player(p_Name, p_Nick, "", p_PlayerNumber, p_PlayerZone);
            return Player.CreatePlayer(oPlayer, p_TournamentList);
            
        }
        catch{
            return -1;
        }
    }
   
}
